home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-07-19 | 88.2 KB | 3,129 lines |
- // (C) Copyright Microsoft Corp. 1991. All rights reserved.
- //
- // You have a royalty-free right to use, modify, reproduce and
- // distribute the Sample Files (and/or any modified version) in
- // any way you find useful, provided that you agree that
- // Microsoft has no warranty obligations or liability for any
- // Sample Application Files which are modified.
-
-
- /****************************************************************************
-
- MODULE : PLAYVFW.C
-
- PURPOSE : Calls into the DLL sndply. Demonstrates that MCI functions
- can be called from a DLL.
-
- FUNCTIONS : About
- PlayVFWInit
- PlayVFWWinProc
- WinMain
-
-
- COMMENTS : This program implements playing VFWfiles using the DLL
- sndply.
-
- HISTORY :
-
- ****************************************************************************/
-
- #include "windows.h"
- #include <stdlib.h>
- #include "playvfw.h"
- #include "proto.h"
- #include "mmsystem.h"
- #include <digitalv.h>
-
- /****************************************************************************
-
- FUNCTION : About( HWND, unsigned, WORD, LONG )
-
- PURPOSE : This function processes Dialog Box messages associated with
- the about dialog box.
-
- COMMENTS :
-
-
- HISTORY :
-
- ****************************************************************************/
-
-
- BOOL FAR PASCAL About( hDlg, message, wParam, lParam )
- HWND hDlg;
- unsigned message;
- WORD wParam;
- LONG lParam;
- {
- if (message == WM_COMMAND) {
- EndDialog( hDlg, TRUE );
- return TRUE;
- }
- else if (message == WM_INITDIALOG)
- return TRUE;
- else return FALSE;
- }
-
-
- void PlayVFWPaint( hDC )
- HDC hDC;
- {
- HANDLE hLibrary;
- FARPROC lpfnUpdateVFW;
- HDC hTempDC;
- DWORD dwBackColor;
-
- // Set the Background color to black.
-
- SetBkColor(hDC,RGB(255,255,255));
-
-
- return;
- }
-
-
- /* Procedure called when the application is loaded for the first time */
-
- BOOL PlayVFWInit( hInstance )
- HANDLE hInstance;
- {
- PWNDCLASS pplayvfwClass;
- PWNDCLASS pVidWinClass;
-
- /* Load strings from resource */
- LoadString( hInstance, IDSNAME, (LPSTR)szAppName, 10 );
- LoadString( hInstance, IDSABOUT, (LPSTR)szAbout, 10 );
- MessageLength = LoadString( hInstance, IDSTITLE, (LPSTR)szMessage, 25 );
-
- // set up a class without a menu.
-
- pplayvfwClass = (PWNDCLASS)LocalAlloc( LPTR, sizeof(WNDCLASS) );
-
- pplayvfwClass->hCursor = LoadCursor( NULL, IDC_ARROW);
- pplayvfwClass->hIcon = LoadIcon( hInstance, MAKEINTRESOURCE(PLAYVFWICON) );
- pplayvfwClass->lpszMenuName = NULL;
- pplayvfwClass->lpszClassName = (LPSTR)szAppName;
- pplayvfwClass->hbrBackground = (HBRUSH)GetStockObject( BLACK_BRUSH );
- pplayvfwClass->hInstance = hInstance;
- pplayvfwClass->style = CS_HREDRAW | CS_VREDRAW;
- pplayvfwClass->lpfnWndProc = PlayVFWWndProc;
-
- if (!RegisterClass( (LPWNDCLASS)pplayvfwClass ) )
- /* Initialization failed.
- * Windows will automatically deallocate all allocated memory.
- */
- return FALSE;
-
- LocalFree( (HANDLE)pplayvfwClass );
-
- pVidWinClass = (PWNDCLASS)LocalAlloc( LPTR, sizeof(WNDCLASS) );
-
- pVidWinClass->hCursor = LoadCursor( NULL, IDC_ARROW);
- pVidWinClass->hIcon = LoadIcon( hInstance, MAKEINTRESOURCE(PLAYVFWICON) );
- pVidWinClass->lpszMenuName = NULL;
- pVidWinClass->lpszClassName = (LPSTR)"VidWin";
- pVidWinClass->hbrBackground = (HBRUSH)GetStockObject( WHITE_BRUSH );
- pVidWinClass->hInstance = hInstance;
- pVidWinClass->style = CS_HREDRAW | CS_VREDRAW;
- pVidWinClass->lpfnWndProc = VideoWndProc;
-
- if (!RegisterClass( (LPWNDCLASS)pVidWinClass ) )
- /* Initialization failed.
- * Windows will automatically deallocate all allocated memory.
- */
- return FALSE;
-
- LocalFree( (HANDLE)pVidWinClass );
- return TRUE; /* Initialization succeeded */
- }
-
-
-
- int PASCAL WinMain( hInstance, hPrevInstance, lpszCmdLine, cmdShow )
- HANDLE hInstance, hPrevInstance;
- LPSTR lpszCmdLine;
- int cmdShow;
- {
- MSG msg;
- HWND hWnd;
- HMENU hMenu;
- HMENU hMyMenu;
- FARPROC lpfnPlayVFWFile;
-
- if (!hPrevInstance) {
- /* Call initialization procedure if this is the first instance */
- if (!PlayVFWInit( hInstance ))
- return FALSE;
- }
- else {
- /* Copy data from previous instance */
- GetInstanceData( hPrevInstance, (PSTR)szAppName, 10 );
- GetInstanceData( hPrevInstance, (PSTR)szAbout, 10 );
- GetInstanceData( hPrevInstance, (PSTR)szMessage, 40 );
- GetInstanceData( hPrevInstance, (PSTR)&MessageLength, sizeof(int) );
- }
-
- // load the plyvfw.dll file and check if it exists before we decide to continue with the program.
- // This file contains all the calls into mmsystem.dll.
-
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
-
- if (hLibrary < 32)
- {
- MessageBox(NULL,"The plyvfw.dll file is missing please copy this file and try again","ERROR",MB_OK);
- return FALSE;
- }
- else
-
- FreeLibrary(hLibrary);
-
- // Allocate memory for each of the different devices (owner draw buttons). This program contains up
- // to 8 different devices which can be active at any given time. A device structure describes the
- // different attributes of an owner draw button. For example the device ID of the AVI file displayed
- // in the owner draw button is stored in the hDevice structure.
-
-
- hDevice1=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
- hDevice2=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
- hDevice3=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
- hDevice4=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
- hDevice5=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
- hDevice6=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
- hDevice7=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
- hDevice8=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
- hDevice9=GlobalAlloc(GHND,sizeof(DEVICESTRUCT));
-
- // make sure all of the memory was allocated. If not drop out of the program.
-
- if (!hDevice1 && !hDevice2 && !hDevice3 && !hDevice4 && !hDevice5 && !hDevice6 && !hDevice7 && !hDevice8 && !hDevice9)
- {
- MessageBox(NULL,"The Initial memory allocation failed aborting program","ERROR",MB_OK);
- return FALSE;
- }
-
- // lock all the memory once so it can be used in the rest of the program.
-
- lpDevice1=(LPDEVICESTRUCT)GlobalLock(hDevice1);
- lpDevice2=(LPDEVICESTRUCT)GlobalLock(hDevice2);
- lpDevice3=(LPDEVICESTRUCT)GlobalLock(hDevice3);
- lpDevice4=(LPDEVICESTRUCT)GlobalLock(hDevice4);
- lpDevice5=(LPDEVICESTRUCT)GlobalLock(hDevice5);
- lpDevice6=(LPDEVICESTRUCT)GlobalLock(hDevice6);
- lpDevice7=(LPDEVICESTRUCT)GlobalLock(hDevice7);
- lpDevice8=(LPDEVICESTRUCT)GlobalLock(hDevice8);
- lpDevice9=(LPDEVICESTRUCT)GlobalLock(hDevice9);
-
- // Make sure that the memory could be locked.
-
- if (!lpDevice1 && !lpDevice2 && !lpDevice3 && !lpDevice4 && !lpDevice5 && !lpDevice6 && !lpDevice7 && !lpDevice8 && !lpDevice9)
- {
- MessageBox(NULL,"The Initial memory lock failed aborting program","ERROR",MB_OK);
- return FALSE;
- }
-
-
- hWnd = CreateWindow((LPSTR)szAppName,
- (LPSTR)szMessage,
- WS_OVERLAPPED | WS_MAXIMIZE,
- CW_USEDEFAULT, /* x - ignored for tiled windows */
- CW_USEDEFAULT, /* y - ignored for tiled windows */
- CW_USEDEFAULT, /* cx - ignored for tiled windows */
- CW_USEDEFAULT, /* cy - ignored for tiled windows */
- (HWND)NULL, /* no parent */
- (HMENU)NULL, /* use class menu */
- (HANDLE)hInstance, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
- // retrieve the Video For Windows information as well as the audio information from the
- // initialization files.
-
- if(!InitVFWStuff(hWnd,hInstance))
- return FALSE;
-
- hWndMain=hWnd;
- bButtonDown=FALSE;
-
- /* Save instance handle for DialogBox */
- hInst = hInstance;
-
-
- // Load a cursor for each window.
-
- lpDevice1->hCursor=LoadCursor( hInstance, MAKEINTRESOURCE(TEXTCURSOR) );
- lpDevice2->hCursor=LoadCursor( hInstance, MAKEINTRESOURCE(AUDIOCURSOR) );
- lpDevice3->hCursor=LoadCursor( hInstance, MAKEINTRESOURCE(VIDEOCURSOR) );
- lpDevice4->hCursor=LoadCursor( hInstance, MAKEINTRESOURCE(ANIMATIONCURSOR) );
- lpDevice5->hCursor=LoadCursor( hInstance, MAKEINTRESOURCE(GRAPHICSCURSOR) );
- lpDevice6->hCursor=LoadCursor( hInstance, MAKEINTRESOURCE(HELPCURSOR) );
-
- hHelloCursor=LoadCursor( NULL, IDC_ARROW );
-
-
- /* Make window visible according to the way the app is activated */
- //ShowWindow( hWnd, cmdShow );
- ShowWindow( hWnd, SW_MAXIMIZE );
- UpdateWindow( hWnd );
-
- hWndButtonBar=0;
- /* Polling messages from event queue */
- while (GetMessage((LPMSG)&msg, NULL, 0, 0))
- {
- if (hWndButtonBar==0 || !IsDialogMessage(hWndButtonBar,&msg))
- {
- TranslateMessage((LPMSG)&msg);
- DispatchMessage((LPMSG)&msg);
- }
- }
-
- return (int)msg.wParam;
- }
-
- /****************************************************************************
-
- FUNCTION : PlayVFWWndProc( HWND, unsigned, WORD, LONG)
-
- PURPOSE : This is the main PlayVFWWnd procedure. This function
- calls into the DLL plysnd.
-
- COMMENTS :
-
-
- HISTORY :
-
- ****************************************************************************/
-
- /* Procedures which make up the window class. */
- long FAR PASCAL PlayVFWWndProc( hWnd, message, wParam, lParam )
- HWND hWnd;
- unsigned message;
- WORD wParam;
- LONG lParam;
- {
- //PAINTSTRUCT ps;
- //HMENU hMyMenu;
-
- FARPROC lpfnPlayVFWFile;
- FARPROC lpfnUpdateVFW;
- FARPROC lpfnPlayVFWFileWait;
- FARPROC lpfnCloseVFWFile;
- FARPROC lpfnCloseVFWDevice;
- FARPROC lpfnSeekVFWToStart;
- FARPROC lpfnCloseWaveDevice;
- FARPROC lpfnPlayWaveFile;
- FARPROC lpfnCloseWaveFile;
-
- BOOL bReturn;
- WORD wCurrentDevice;
-
- UINT uixPos;
- UINT uiyPos;
- RECT ChildWinRect;
- HDC hTempDC;
-
- switch (message)
- {
- case WM_CREATE:
-
- break;
-
- case WM_SYSCOMMAND:
- switch (wParam)
- {
-
- case IDSABOUT:
- /* Bind callback function with module instance */
- lpprocAbout = MakeProcInstance( (FARPROC)About, hInst);
-
- DialogBox( hInst, MAKEINTRESOURCE(ABOUTBOX), hWnd, lpprocAbout );
- FreeProcInstance(lpprocAbout);
- break;
-
- default:
- return DefWindowProc( hWnd, message, wParam, lParam );
-
- }
- break;
-
- case WM_COMMAND:
- break;
-
- case WM_USER+1:
- MessageBox(hWndMain,"I'm closing now","Goodbye",MB_OK);
-
- PostMessage(hWndMain,WM_CLOSE,0,0L);
- break;
-
-
- // This message is sent to the parent window of an Owner Draw button when some action is taken in
- // that owner draw button. The action I am looking for is a Left Button Down message. Since the
- // Owner draw button has its own window procedure the WM_LBUTTONDOWN message will not be directly
- // sent to the parents window procedure. Inderectly windows sends a WM_PARENTNOTIFY message.
-
- case WM_PARENTNOTIFY:
-
- // When we recieve a WM_PARENTNOTIFY message the action that was taken is represented in the wParam.
- // We are looking for a Left Button click, for simplicity all we care about is that the button was
- // pressed.
-
- if (wParam==WM_LBUTTONDOWN)
- {
- // Grab the X and Y position of the Mouse cursor which is stored in the high and low word of
- // the lParam. This postion will help determine which button the cursor was over when the
- // mouse button was depressed.
-
- uixPos=LOWORD(lParam);
- uiyPos=HIWORD(lParam);
-
- // The Function GetRealClientRect is used to retrieve the x,y,dx,dy position of the button.
- // The coordinates retrieved is relative to the top left corner of the client area and not
- // the screen. Therefore these coordinates are relative to what is being returned in the
- // Low and High word of lParam.
-
- GetRealClientRect(lpDevice1->hWnd,hWnd,&ChildWinRect);
-
- // check to see if the button was depressed while the cursor was over the owner draw button.
-
- if ((uixPos < ChildWinRect.right) && (uiyPos > ChildWinRect.top) && (uixPos > ChildWinRect.left) && (uiyPos < ChildWinRect.bottom) )
- {
-
- // if the button was depressed while the cursor was over the owner draw button and this
- // is page 2 do the stuff appropriate to page 2.
-
- if (bIsPage2)
- {
- //PostMessage(hWndMain,WM_USER+1,0,0L);
-
- MessageBox(hWndMain,"Window 1","Here We go",MB_OK);
- // if (bButtonDown)
- // bButtonDown=FALSE;
- // else
- //PostMessage(hWndMain,WM_CLOSE,0,0L);
- ShowWindow( lpDevice9->hWnd, SW_HIDE );
- ShowWindow(hWndEdit, SW_SHOWNORMAL );
- return FALSE;
- }
-
- if(bIsPage1)
- {
-
- // if this is page 1 set that a button was clicked and that there is no video playing.
-
- lpDevice1->bRButtonClicked=TRUE;
- lpDevice1->bVideoPlaying=FALSE;
-
- SeekAllToStart();
-
- ShowWindow( lpDevice1->hWnd, SW_HIDE );
-
- //ChildWinRect.left=ChildWinRect.left-50;
- //ChildWinRect.top=ChildWinRect.top-50;
- //ChildWinRect.bottom=ChildWinRect.bottom+50;
- // ChildWinRect.right=ChildWinRect.right+50;
-
- //MoveWindow(lpDevice8->hWnd,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,TRUE);
- //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
-
- //SetWindowPos(lpDevice8->hWnd,HWND_TOPMOST,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,SWP_SHOWWINDOW);
- //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
-
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
-
- if (hLibrary >= 32)
- {
-
- Morph(lpDevice8,1,hLibrary);
-
- lpfnPlayVFWFileWait = GetProcAddress(hLibrary, MAKEINTRESOURCE(14));
- lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
-
- hTempDC=GetDC(lpDevice8->hWnd);
-
- (*lpfnUpdateVFW) (lpDevice8->wDeviceID,hTempDC);
-
- ReleaseDC(lpDevice8->hWnd,hTempDC);
-
- (*lpfnPlayVFWFileWait) (hWnd,lpDevice8->hWnd,lpDevice8->wDeviceID);
- ShowWindow( lpDevice8->hWnd, SW_HIDE );
-
- lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
-
- bReturn = (*lpfnCloseWaveFile) (lpDevice8->wAudioDeviceID);
-
- lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
-
-
- bReturn = (*lpfnCloseVFWFile) (lpDevice8->wDeviceID);
-
-
- DoNextPage(hLibrary,1);
-
- FreeLibrary(hLibrary);
- }
-
- //bIsPage1=FALSE;
- // bIsPage2=TRUE;
-
- //DrawRectOutsideButton(hWnd,ChildWinRect);
- } // if bIsPage1
- return FALSE;
- }
-
- GetRealClientRect(lpDevice2->hWnd,hWnd,&ChildWinRect);
- if ((uixPos < ChildWinRect.right) && (uiyPos > ChildWinRect.top) && (uixPos > ChildWinRect.left) && (uiyPos < ChildWinRect.bottom) )
- {
- if (bIsPage2)
- {
-
- //PostMessage(hWndMain,WM_USER+1,0,0L);
- //PostMessage(hWndMain,WM_CLOSE,0,0L);
- //MessageBox(hWndMain,"Window 2","Here We go",MB_OK);
- // if (bButtonDown)
- // bButtonDown=FALSE;
- // else
- // PostMessage(hWndMain,WM_CLOSE,0,0L);
- ShowWindow( lpDevice9->hWnd, SW_HIDE );
- ShowWindow(hWndEdit, SW_SHOWNORMAL );
-
- return FALSE;
- //FreeDevices(hWndMain);
- }
-
- if(bIsPage1)
- {
- lpDevice2->bVideoPlaying=FALSE;
- lpDevice2->bRButtonClicked=TRUE;
- SeekAllToStart();
-
- ShowWindow( lpDevice2->hWnd, SW_HIDE );
-
- //ChildWinRect.left=ChildWinRect.left-50;
- //ChildWinRect.top=ChildWinRect.top-50;
- // ChildWinRect.bottom=ChildWinRect.bottom+50;
- // ChildWinRect.right=ChildWinRect.right+50;
-
- //MoveWindow(lpDevice8->hWnd,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,TRUE);
- //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
- //SetWindowPos(lpDevice8->hWnd,HWND_TOPMOST,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,SWP_SHOWWINDOW);
- //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
-
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
-
- if (hLibrary >= 32)
- {
-
- lpfnPlayVFWFileWait = GetProcAddress(hLibrary, MAKEINTRESOURCE(14));
- lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
-
- Morph(lpDevice8,2,hLibrary);
-
- hTempDC=GetDC(lpDevice8->hWnd);
-
- (*lpfnUpdateVFW) (lpDevice8->wDeviceID,hTempDC);
-
- ReleaseDC(lpDevice8->hWnd,hTempDC);
- (*lpfnPlayVFWFileWait) (hWnd,lpDevice8->hWnd,lpDevice8->wDeviceID);
- ShowWindow( lpDevice8->hWnd, SW_HIDE );
- lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
-
- bReturn = (*lpfnCloseWaveFile) (lpDevice8->wAudioDeviceID);
-
- lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
-
-
- bReturn = (*lpfnCloseVFWFile) (lpDevice8->wDeviceID);
-
-
-
- DoNextPage(hLibrary,2);
- FreeLibrary(hLibrary);
- }
-
- // bIsPage1=FALSE;
- //bIsPage2=TRUE;
-
- //DrawRectOutsideButton(hWnd,ChildWinRect);
- } //bPageIs1
-
- return FALSE;
- }
-
- GetRealClientRect(lpDevice3->hWnd,hWnd,&ChildWinRect);
- if ((uixPos < ChildWinRect.right) && (uiyPos > ChildWinRect.top) && (uixPos > ChildWinRect.left) && (uiyPos < ChildWinRect.bottom) )
- {
- if (bIsPage2)
- {
- //SeekAllToStart();
- // MessageBox(hWndMain,"Window 3","Here We go",MB_OK);
- //if (bButtonDown)
- // bButtonDown=FALSE;
- // else
- //PostMessage(hWndMain,WM_CLOSE,0,0L);
-
- ShowWindow( hWndEdit, SW_HIDE );
- ShowWindow(lpDevice9->hWnd, SW_SHOWNORMAL );
-
- if(lstrlen(lpDevice3->szFileName))
-
-
-
- //PostMessage(hWndMain,WM_USER+1,0,0L);
- return FALSE;
- }
-
- if(bIsPage1)
- {
- lpDevice3->bRButtonClicked=TRUE;
- lpDevice3->bVideoPlaying=FALSE;
- SeekAllToStart();
- ShowWindow( lpDevice3->hWnd, SW_HIDE );
-
- //ChildWinRect.left=ChildWinRect.left-50;
- // ChildWinRect.top=ChildWinRect.top-50;
- // ChildWinRect.bottom=ChildWinRect.bottom+50;
- // ChildWinRect.right=ChildWinRect.right+50;
-
- //MoveWindow(lpDevice8->hWnd,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,TRUE);
- //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
- // SetWindowPos(lpDevice8->hWnd,HWND_TOPMOST,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,SWP_SHOWWINDOW);
- // ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
-
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
-
- if (hLibrary >= 32)
- {
- lpfnPlayVFWFileWait = GetProcAddress(hLibrary, MAKEINTRESOURCE(14));
- lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
- Morph(lpDevice8,3,hLibrary);
-
- hTempDC=GetDC(lpDevice8->hWnd);
-
- (*lpfnUpdateVFW) (lpDevice8->wDeviceID,hTempDC);
-
- ReleaseDC(lpDevice8->hWnd,hTempDC);
- (*lpfnPlayVFWFileWait) (hWnd,lpDevice8->hWnd,lpDevice8->wDeviceID);
- ShowWindow( lpDevice8->hWnd, SW_HIDE );
- lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
-
- bReturn = (*lpfnCloseWaveFile) (lpDevice8->wAudioDeviceID);
-
- lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
-
-
- bReturn = (*lpfnCloseVFWFile) (lpDevice8->wDeviceID);
-
-
- DoNextPage(hLibrary,3);
- FreeLibrary(hLibrary);
- }
-
- // bIsPage1=FALSE;
- // bIsPage2=TRUE;
-
- //DrawRectOutsideButton(hWnd,ChildWinRect);
- }
- return FALSE;
- }
-
- GetRealClientRect(lpDevice4->hWnd,hWnd,&ChildWinRect);
- if ((uixPos < ChildWinRect.right) && (uiyPos > ChildWinRect.top) && (uixPos > ChildWinRect.left) && (uiyPos < ChildWinRect.bottom) )
- {
- if (bIsPage2)
- {
- ShowWindow( hWndEdit, SW_HIDE );
- ShowWindow(lpDevice9->hWnd, SW_SHOWNORMAL );
-
- if (lstrlen(lpDevice4->szFileName))
- WinExec(lpDevice4->szFileName,SW_SHOW);
-
- return FALSE;
-
- }
-
- if(bIsPage1)
- {
- lpDevice4->bRButtonClicked=TRUE;
- lpDevice4->bVideoPlaying=FALSE;
-
- SeekAllToStart();
- ShowWindow( lpDevice4->hWnd, SW_HIDE );
-
- //ChildWinRect.left=ChildWinRect.left-50;
- //ChildWinRect.top=ChildWinRect.top-50;
- // ChildWinRect.bottom=ChildWinRect.bottom+50;
- //ChildWinRect.right=ChildWinRect.right+50;
-
- //MoveWindow(lpDevice8->hWnd,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,TRUE);
- //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
- //SetWindowPos(lpDevice8->hWnd,HWND_TOPMOST,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,SWP_SHOWWINDOW);
- // ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
-
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
-
- if (hLibrary >= 32)
- {
- lpfnPlayVFWFileWait = GetProcAddress(hLibrary, MAKEINTRESOURCE(14));
- lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
- Morph(lpDevice8,4,hLibrary);
-
- hTempDC=GetDC(lpDevice8->hWnd);
-
- (*lpfnUpdateVFW) (lpDevice8->wDeviceID,hTempDC);
-
- ReleaseDC(lpDevice8->hWnd,hTempDC);
- (*lpfnPlayVFWFileWait) (hWnd,lpDevice8->hWnd,lpDevice8->wDeviceID);
- ShowWindow( lpDevice8->hWnd, SW_HIDE );
- lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
-
- bReturn = (*lpfnCloseWaveFile) (lpDevice8->wAudioDeviceID);
-
- lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
-
-
- bReturn = (*lpfnCloseVFWFile) (lpDevice8->wDeviceID);
-
-
- DoNextPage(hLibrary,4);
- FreeLibrary(hLibrary);
- }
-
- //bIsPage1=FALSE;
- //bIsPage2=TRUE;
-
- //DrawRectOutsideButton(hWnd,ChildWinRect);
- }
- return FALSE;
- }
-
- GetRealClientRect(lpDevice5->hWnd,hWnd,&ChildWinRect);
- if ((uixPos < ChildWinRect.right) && (uiyPos > ChildWinRect.top) && (uixPos > ChildWinRect.left) && (uiyPos < ChildWinRect.bottom) )
- {
- if (bIsPage2)
- {
- MessageBox(hWndMain,"Window 5","Here We go",MB_OK);
- if (bButtonDown)
- bButtonDown=FALSE;
- else
- PostMessage(hWndMain,WM_CLOSE,0,0L);
- //PostMessage(hWndMain,WM_USER+1,0,0L);
- }
-
- if(bIsPage1)
- {
- lpDevice5->bRButtonClicked=TRUE;
- lpDevice5->bVideoPlaying=FALSE;
- SeekAllToStart();
- ShowWindow( lpDevice5->hWnd, SW_HIDE );
-
- //ChildWinRect.left=ChildWinRect.left-50;
- //ChildWinRect.top=ChildWinRect.top-50;
- //ChildWinRect.bottom=ChildWinRect.bottom+50;
- //ChildWinRect.right=ChildWinRect.right+50;
-
- //MoveWindow(lpDevice8->hWnd,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,TRUE);
- //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
-
- //SetWindowPos(lpDevice8->hWnd,HWND_TOPMOST,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,SWP_SHOWWINDOW);
- //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
-
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
-
- if (hLibrary >= 32)
- {
- lpfnPlayVFWFileWait = GetProcAddress(hLibrary, MAKEINTRESOURCE(14));
- lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
- Morph(lpDevice8,5,hLibrary);
- //lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
- hTempDC=GetDC(lpDevice8->hWnd);
-
- (*lpfnUpdateVFW) (lpDevice8->wDeviceID,hTempDC);
-
- ReleaseDC(lpDevice8->hWnd,hTempDC);
- (*lpfnPlayVFWFileWait) (hWnd,lpDevice8->hWnd,lpDevice8->wDeviceID);
- ShowWindow( lpDevice8->hWnd, SW_HIDE );
- lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
-
- bReturn = (*lpfnCloseWaveFile) (lpDevice8->wAudioDeviceID);
-
- lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
-
-
- bReturn = (*lpfnCloseVFWFile) (lpDevice8->wDeviceID);
-
-
- DoNextPage(hLibrary,5);
- FreeLibrary(hLibrary);
- }
-
- //bIsPage1=FALSE;
- //bIsPage2=TRUE;
-
- //DrawRectOutsideButton(hWnd,ChildWinRect);
- }
- return FALSE;
- }
-
-
- GetRealClientRect(lpDevice6->hWnd,hWnd,&ChildWinRect);
- if ((uixPos < ChildWinRect.right) && (uiyPos > ChildWinRect.top) && (uixPos > ChildWinRect.left) && (uiyPos < ChildWinRect.bottom) )
- {
- if (bIsPage2)
- {
- MessageBox(hWndMain,"Window 6","Here We go",MB_OK);
- if (bButtonDown)
- bButtonDown=FALSE;
- else
- PostMessage(hWndMain,WM_CLOSE,0,0L);
- //PostMessage(hWndMain,WM_USER+1,0,0L);
- }
-
- if(bIsPage1)
- {
- lpDevice6->bRButtonClicked=TRUE;
- lpDevice6->bVideoPlaying=FALSE;
- SeekAllToStart();
- ShowWindow( lpDevice6->hWnd, SW_HIDE );
-
- //ChildWinRect.left=ChildWinRect.left-50;
- //ChildWinRect.top=ChildWinRect.top-50;
- // ChildWinRect.bottom=ChildWinRect.bottom+50;
- // ChildWinRect.right=ChildWinRect.right+50;
-
- //MoveWindow(lpDevice8->hWnd,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,TRUE);
- //ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
-
- // SetWindowPos(lpDevice8->hWnd,HWND_TOPMOST,ChildWinRect.left,ChildWinRect.top,ChildWinRect.bottom,ChildWinRect.right,SWP_SHOWWINDOW);
- // ShowWindow( lpDevice8->hWnd, SW_SHOWNORMAL );
-
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
-
- if (hLibrary >= 32)
- {
- lpfnPlayVFWFileWait = GetProcAddress(hLibrary, MAKEINTRESOURCE(14));
- lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
-
- Morph(lpDevice8,6,hLibrary);
- hTempDC=GetDC(lpDevice8->hWnd);
-
- (*lpfnUpdateVFW) (lpDevice8->wDeviceID,hTempDC);
-
- ReleaseDC(lpDevice8->hWnd,hTempDC);
-
- (*lpfnPlayVFWFileWait) (hWnd,lpDevice8->hWnd,lpDevice8->wDeviceID);
-
- ShowWindow( lpDevice8->hWnd, SW_HIDE );
-
- lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
-
- bReturn = (*lpfnCloseWaveFile) (lpDevice8->wAudioDeviceID);
-
- lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
-
-
- bReturn = (*lpfnCloseVFWFile) (lpDevice8->wDeviceID);
-
-
- DoNextPage(hLibrary,6);
- FreeLibrary(hLibrary);
- }
-
- //bIsPage1=FALSE;
- //bIsPage2=TRUE;
-
- //DrawRectOutsideButton(hWnd,ChildWinRect);
- }
- return FALSE;
- }
-
- } // end of if wParam == WM_RBUTTONDOWN
-
- if (wParam==WM_RBUTTONDOWN)
- {
- if (bIsPage2)
- PostMessage(hWndMain,WM_CLOSE,0,0L);
-
- if (bIsPage0)
- DoPage1();
- }
-
- return FALSE;
- break;
-
- return FALSE;
- break;
-
- case MM_MCINOTIFY:
-
- /* This is where we check the status of an AVI */
- /* movie that might have been playing. We do */
- /* the play with MCI_NOTIFY on so we should get */
- /* a MCI_NOTIFY_SUCCESSFUL if the play */
- /* completes on it's own. */
-
- switch(wParam)
- {
- case MCI_NOTIFY_SUCCESSFUL:
- {
-
- /* the play finished, let's rewind */
- /* and clear our flag. */
-
- //fPlaying = FALSE;
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
-
- if (hLibrary >= 32)
- {
-
- lpfnSeekVFWToStart = GetProcAddress(hLibrary, MAKEINTRESOURCE(8));
- lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
-
- wCurrentDevice=LOWORD(lParam);
-
- (*lpfnSeekVFWToStart) (wCurrentDevice);
-
- //if ((wCurrentDevice==lpDevice1->wDeviceID) && lpDevice1->bPlayVideo)
- // (*lpfnPlayVFWFile) (hWnd,lpDevice1->hWnd,wCurrentDevice);
-
- if ((wCurrentDevice==lpDevice1->wDeviceID) && lpDevice1->bVideoPlaying)
- (*lpfnPlayVFWFile) (hWnd,lpDevice1->hWnd,wCurrentDevice);
-
- if ((wCurrentDevice==lpDevice2->wDeviceID) && lpDevice2->bVideoPlaying)
- (*lpfnPlayVFWFile) (hWnd,lpDevice2->hWnd,wCurrentDevice);
-
- if ((wCurrentDevice==lpDevice3->wDeviceID) && lpDevice3->bVideoPlaying)
- (*lpfnPlayVFWFile) (hWnd,lpDevice3->hWnd,wCurrentDevice);
-
- if ((wCurrentDevice==lpDevice4->wDeviceID) && lpDevice4->bVideoPlaying)
- (*lpfnPlayVFWFile) (hWnd,lpDevice4->hWnd,wCurrentDevice);
-
- if ((wCurrentDevice==lpDevice5->wDeviceID) && lpDevice5->bVideoPlaying)
- (*lpfnPlayVFWFile) (hWnd,lpDevice5->hWnd,wCurrentDevice);
-
- if ((wCurrentDevice==lpDevice6->wDeviceID) && lpDevice6->bVideoPlaying)
- (*lpfnPlayVFWFile) (hWnd,lpDevice6->hWnd,wCurrentDevice);
-
- if ((wCurrentDevice==lpDevice7->wDeviceID) && lpDevice7->bVideoPlaying && bIsPage0)
- {
- DoPage1();
-
-
- //(*lpfnPlayVFWFile) (hWnd,lpDevice6->hWnd,wCurrentDevice);
- }
-
-
- FreeLibrary(hLibrary);
- }
-
- //mciSendCommand(wGlobalDeviceID, MCI_SEEK, MCI_SEEK_TO_START, (DWORD)(LPVOID)NULL);
- return FALSE;
- }
- }
- break;
-
- case WM_DRAWITEM:
- DrawControl(hWnd, (LPDRAWITEMSTRUCT)lParam);
- break;
-
-
-
- case WM_CLOSE:
- FreeDevices(hWndMain);
- DestroyWindow(hWndButtonBar);
-
- DestroyWindow(lpDevice1->hWnd);
- DestroyWindow(lpDevice2->hWnd);
- DestroyWindow(lpDevice3->hWnd);
- DestroyWindow(lpDevice4->hWnd);
- DestroyWindow(lpDevice5->hWnd);
- DestroyWindow(lpDevice6->hWnd);
- DestroyWindow(lpDevice7->hWnd);
- DestroyWindow(lpDevice8->hWnd);
- DestroyWindow(lpDevice9->hWnd);
-
- SetCursor(hHelloCursor);
-
- DestroyCursor(lpDevice1->hCursor);
- DestroyCursor(lpDevice2->hCursor);
- DestroyCursor(lpDevice3->hCursor);
- DestroyCursor(lpDevice4->hCursor);
- DestroyCursor(lpDevice5->hCursor);
- DestroyCursor(lpDevice6->hCursor);
- //DestroyCursor(lpDevice7->hCursor);
- //DestroyCursor(lpDevice8->hCursor);
-
- GlobalUnlock(hDevice1);
- GlobalFree(hDevice1);
-
- GlobalUnlock(hDevice2);
- GlobalFree(hDevice2);
-
- GlobalUnlock(hDevice3);
- GlobalFree(hDevice3);
-
- GlobalUnlock(hDevice4);
- GlobalFree(hDevice4);
-
- GlobalUnlock(hDevice5);
- GlobalFree(hDevice5);
-
- GlobalUnlock(hDevice6);
- GlobalFree(hDevice6);
-
- GlobalUnlock(hDevice7);
- GlobalFree(hDevice7);
-
- GlobalUnlock(hDevice8);
- GlobalFree(hDevice8);
-
- GlobalUnlock(hDevice9);
- GlobalFree(hDevice9);
-
- DestroyWindow(hWnd);
-
- return FALSE;
- break;
-
- case WM_SETCURSOR:
-
- if(wParam==lpDevice1->hWnd)
- {
- if(bIsPage1)
- SetCursor(lpDevice1->hCursor);
-
- if(!lpDevice1->bVideoPlaying)
- {
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
- if (hLibrary >= 32)
- {
- lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
- lpfnPlayWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(17));
-
- SeekAllToStart();
-
- //if (lstrlen(lpDevice1->szAudioFile))
- // (*lpfnSndPlaySnd) (lpDevice1->hWnd,lpDevice1->szAudioFile);
-
-
-
- (*lpfnPlayVFWFile) (hWnd,lpDevice1->hWnd,lpDevice1->wDeviceID);
- (*lpfnPlayWaveFile) (lpDevice1->wAudioDeviceID);
-
- lpDevice1->bVideoPlaying=TRUE;
- FreeLibrary(hLibrary);
- }
-
- break;
- }
-
- return TRUE;
- }
-
- if(wParam==lpDevice2->hWnd)
- {
-
- if(bIsPage1)
- SetCursor(lpDevice2->hCursor);
-
- if(!lpDevice2->bVideoPlaying)
- {
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
- if (hLibrary >= 32)
- {
- lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
- lpfnPlayWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(17));
-
- SeekAllToStart();
- //if (lstrlen(lpDevice2->szAudioFile))
- // (*lpfnSndPlaySnd) (lpDevice2->hWnd,lpDevice2->szAudioFile);
-
-
- (*lpfnPlayVFWFile) (hWnd,lpDevice2->hWnd,lpDevice2->wDeviceID);
- (*lpfnPlayWaveFile) (lpDevice2->wAudioDeviceID);
-
- lpDevice2->bVideoPlaying=TRUE;
- FreeLibrary(hLibrary);
- }
- break;
- }
-
- return TRUE;
- }
-
- if(wParam==lpDevice3->hWnd)
- {
- if(bIsPage1)
- SetCursor(lpDevice3->hCursor);
-
- if(!lpDevice3->bVideoPlaying)
- {
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
- if (hLibrary >= 32)
- {
- lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
- lpfnPlayWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(17));
-
- SeekAllToStart();
-
- //if (lstrlen(lpDevice3->szAudioFile))
- // (*lpfnSndPlaySnd) (lpDevice3->hWnd,lpDevice3->szAudioFile);
-
-
- (*lpfnPlayVFWFile) (hWnd,lpDevice3->hWnd,lpDevice3->wDeviceID);
- (*lpfnPlayWaveFile) (lpDevice3->wAudioDeviceID);
-
- lpDevice3->bVideoPlaying=TRUE;
- FreeLibrary(hLibrary);
- }
- break;
- }
-
- return TRUE;
- }
-
- if(wParam==lpDevice4->hWnd)
- {
- if(bIsPage1)
- SetCursor(lpDevice4->hCursor);
-
- if(!lpDevice4->bVideoPlaying)
- {
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
- if (hLibrary >= 32)
- {
- lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
- lpfnPlayWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(17));
-
- SeekAllToStart();
-
- //if (lstrlen(lpDevice4->szAudioFile))
- // (*lpfnSndPlaySnd) (lpDevice4->hWnd,lpDevice4->szAudioFile);
-
-
- (*lpfnPlayVFWFile) (hWnd,lpDevice4->hWnd,lpDevice4->wDeviceID);
- (*lpfnPlayWaveFile) (lpDevice4->wAudioDeviceID);
-
- lpDevice4->bVideoPlaying=TRUE;
- FreeLibrary(hLibrary);
- }
- break;
- }
-
-
- return TRUE;
- }
-
- if(wParam==lpDevice5->hWnd)
- {
- if(bIsPage1)
- SetCursor(lpDevice5->hCursor);
-
- if(!lpDevice5->bVideoPlaying)
- {
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
- if (hLibrary >= 32)
- {
- lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
- lpfnPlayWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(17));
-
- SeekAllToStart();
-
- //if (lstrlen(lpDevice5->szAudioFile))
- // (*lpfnSndPlaySnd) (lpDevice5->hWnd,lpDevice5->szAudioFile);
-
- (*lpfnPlayVFWFile) (hWnd,lpDevice5->hWnd,lpDevice5->wDeviceID);
- (*lpfnPlayWaveFile) (lpDevice5->wAudioDeviceID);
-
- lpDevice5->bVideoPlaying=TRUE;
- FreeLibrary(hLibrary);
- }
- break;
- }
-
-
- return TRUE;
- }
-
- if(wParam==lpDevice6->hWnd)
- {
- if(bIsPage1)
- SetCursor(lpDevice6->hCursor);
-
- if(!lpDevice6->bVideoPlaying)
- {
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
- if (hLibrary >= 32)
- {
- lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
- lpfnPlayWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(17));
-
- SeekAllToStart();
-
- (*lpfnPlayVFWFile) (hWnd,lpDevice6->hWnd,lpDevice6->wDeviceID);
- (*lpfnPlayWaveFile) (lpDevice6->wAudioDeviceID);
-
- lpDevice6->bVideoPlaying=TRUE;
- FreeLibrary(hLibrary);
- }
- break;
- }
-
-
- return TRUE;
- }
-
- if(wParam==hWnd)
- {
- SeekAllToStart();
- SetCursor(hHelloCursor);
- return TRUE;
- }
-
- return FALSE;
-
-
- case WM_DESTROY:
-
- PostQuitMessage( 0 );
- break;
-
- // case WM_PAINT:
-
-
- // BeginPaint( hWnd, (LPPAINTSTRUCT)&ps );
- // PlayVFWPaint( ps.hdc );
- // EndPaint( hWnd, (LPPAINTSTRUCT)&ps );
- // break;
-
- default:
- return DefWindowProc( hWnd, message, wParam, lParam );
- break;
- }
- return(0L);
- }
-
-
-
-
- void DrawControl(HWND hWnd, LPDRAWITEMSTRUCT lpInfo)
- {
- HBITMAP hbm, hOldbm;
- int ResourceID;
- HDC hMemDC;
- RECT ChildWinRect;
-
- FARPROC lpfnPlayVFWFile;
- FARPROC lpfnUpdateVFW;
- FARPROC lpfnPauseVFWFile;
- FARPROC lpfnResumeVFWFile;
- HANDLE hLibrary;
-
-
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
- if (hLibrary >= 32)
- {
- lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
- lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
- lpfnResumeVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(13));
- lpfnPauseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(12));
-
- if (lpInfo->CtlType != ODT_BUTTON) return;
-
- // Load the bitmap for the image
-
- switch(lpInfo->CtlID)
- {
-
- case IDC_TEXT:
- if (bIsPage1 || bIsPage2)
- {
-
- //GetRealClientRect(lpDevice1->hWnd,hWnd,&ChildWinRect);
- //DrawRectOutsideButton(hWnd,ChildWinRect);
-
- textrect=lpInfo->rcItem;
-
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- (*lpfnUpdateVFW) (lpDevice1->wDeviceID,lpInfo->hDC);
- }
-
- } // bIsPage1
-
- break;
-
- case IDC_AUDIO:
- if (bIsPage1 || bIsPage2)
- {
- //GetRealClientRect(lpDevice2->hWnd,hWnd,&ChildWinRect);
- // DrawRectOutsideButton(hWnd,ChildWinRect);
-
- audiorect=lpInfo->rcItem;
-
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- (*lpfnUpdateVFW) (lpDevice2->wDeviceID,lpInfo->hDC);
- }
- } // bIsPage1
- break;
-
-
-
- case IDC_VIDEO:
- if (bIsPage1 || bIsPage2)
- {
- //if (lpInfo->itemState & ODS_SELECT)
-
- //GetRealClientRect(lpDevice3->hWnd,hWnd,&ChildWinRect);
- //DrawRectOutsideButton(hWnd,ChildWinRect);
-
- videorect=lpInfo->rcItem;
-
-
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- (*lpfnUpdateVFW) (lpDevice3->wDeviceID,lpInfo->hDC);
- }
-
- } // bIsPage1
- break;
-
- case IDC_ANIMATION:
- if (bIsPage1 || bIsPage2)
- {
- //GetRealClientRect(lpDevice4->hWnd,hWnd,&ChildWinRect);
- //DrawRectOutsideButton(hWnd,ChildWinRect);
-
- animationrect=lpInfo->rcItem;
-
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- (*lpfnUpdateVFW) (lpDevice4->wDeviceID,lpInfo->hDC);
- }
- }// bIsPage1
- break;
-
-
- case IDC_GRAPHICS:
- if (bIsPage1 || bIsPage2)
- {
- //GetRealClientRect(lpDevice5->hWnd,hWnd,&ChildWinRect);
- //DrawRectOutsideButton(hWnd,ChildWinRect);
-
- graphicsrect=lpInfo->rcItem;
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- (*lpfnUpdateVFW) (lpDevice5->wDeviceID,lpInfo->hDC);
-
- }
-
- }//bIsPage1
- break;
-
- case IDC_HELP:
- if (bIsPage1 || bIsPage2)
- {
- // GetRealClientRect(lpDevice6->hWnd,hWnd,&ChildWinRect);
- // DrawRectOutsideButton(hWnd,ChildWinRect);
-
- helprect=lpInfo->rcItem;
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- (*lpfnUpdateVFW) (lpDevice6->wDeviceID,lpInfo->hDC);
- //if (lpDevice6->bPlayVideo)
- // (*lpfnPlayVFWFile) (hWnd,lpInfo->hwndItem,lpDevice6->wDeviceID);
-
- }
-
-
- }//bIsPage1
- break;
-
- case IDC_VIDWIN:
- if (bIsPage0)
- {
- // GetRealClientRect(lpDevice7->hWnd,hWnd,&ChildWinRect);
- // DrawRectOutsideButton(hWnd,ChildWinRect);
-
- helprect=lpInfo->rcItem;
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- (*lpfnUpdateVFW) (lpDevice7->wDeviceID,lpInfo->hDC);
- }
-
- if (lpInfo->itemAction == ODA_SELECT)
- {
- if(lpDevice7->bButtonDown)
- lpDevice7->bButtonDown=FALSE;
- else
- lpDevice7->bButtonDown=TRUE;
- } // if ODA_SELECT
- } //bIsPage0
- break;
-
- case IDC_MORPH:
- // GetRealClientRect(lpDevice8->hWnd,hWnd,&ChildWinRect);
- // DrawRectOutsideButton(hWnd,ChildWinRect);
-
- helprect=lpInfo->rcItem;
- if (lpInfo->itemAction == ODA_DRAWENTIRE)
- {
- (*lpfnUpdateVFW) (lpDevice8->wDeviceID,lpInfo->hDC);
- }
-
- if (lpInfo->itemAction == ODA_SELECT)
- {
- if(lpDevice8->bButtonDown)
- lpDevice8->bButtonDown=FALSE;
- else
- lpDevice8->bButtonDown=TRUE;
-
-
-
- }
-
- break;
-
-
- }
-
- FreeLibrary(hLibrary);
-
- }
-
- return;
- }
-
-
-
-
- BOOL FAR PASCAL InitVFWStuff(hWnd,hInstance)
- HWND hWnd;
- HANDLE hInstance;
- {
- HANDLE hLibrary;
- FARPROC lpfnOpenVFWDevice;
- FARPROC lpfnPlayVFWFile;
- FARPROC lpfnOpenWaveDevice;
-
- MCI_DGV_RECT_PARMS mciRect;
- MCI_DGV_RECT_PARMS mciRect2;
- RECT Points;
-
-
- bIsPage0=TRUE;
- bIsPage1=FALSE;
- bIsPage2=FALSE;
-
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
-
- if (hLibrary >= 32)
- {
-
-
- lpfnOpenVFWDevice = GetProcAddress(hLibrary, MAKEINTRESOURCE(2));
- lpfnOpenWaveDevice = GetProcAddress(hLibrary, MAKEINTRESOURCE(15));
-
- wGlobalDeviceID = (*lpfnOpenVFWDevice) (hWnd);
- wGlobalAudioDeviceID = (*lpfnOpenWaveDevice) ();
-
- /* grey menu item first */
- /* enable second */
-
- if (!wGlobalDeviceID)
- {
- MessageBox(GetFocus(),"Can't open device","ERROR",MB_OK);
- FreeLibrary(hLibrary);
- return FALSE;
- }
-
- if (!wGlobalAudioDeviceID)
- {
- MessageBox(GetFocus(),"Can't open Audio device","ERROR",MB_OK);
- FreeLibrary(hLibrary);
- return FALSE;
- }
-
-
-
- InitDeviceVars(lpDevice1);
-
- if(!GetStuffFromIni(lpDevice1,1,&Points,hLibrary))
- return FALSE;
-
- lpDevice1->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"Text window",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left, /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWnd, /*parent */
- (HMENU)IDC_TEXT, /* use class menu */
- (HANDLE)hInstance, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
- InitDeviceVars(lpDevice2);
-
- GetStuffFromIni(lpDevice2,2,&Points,hLibrary);
-
- lpDevice2->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"Audio Button",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left, /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWnd, /*parent */
- (HMENU)IDC_AUDIO, /* use class menu */
- (HANDLE)hInstance, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
- InitDeviceVars(lpDevice3);
-
- GetStuffFromIni(lpDevice3,3,&Points,hLibrary);
-
- lpDevice3->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"Video Button",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left, /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWnd, /*parent */
- (HMENU)IDC_VIDEO, /* use class menu */
- (HANDLE)hInstance, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
- InitDeviceVars(lpDevice4);
-
- GetStuffFromIni(lpDevice4,4,&Points,hLibrary);
-
- lpDevice4->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"Animation Button",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left, /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWnd, /*parent */
- (HMENU)IDC_ANIMATION, /* use class menu */
- (HANDLE)hInstance, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
- InitDeviceVars(lpDevice5);
-
- GetStuffFromIni(lpDevice5,5,&Points,hLibrary);
-
- lpDevice5->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"Graphics Button",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left, /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWnd, /*parent */
- (HMENU)IDC_GRAPHICS, /* use class menu */
- (HANDLE)hInstance, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
- InitDeviceVars(lpDevice6);
-
- GetStuffFromIni(lpDevice6,6,&Points,hLibrary);
-
- lpDevice6->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"Help Button",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left , /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWnd, /*parent */
- (HMENU)IDC_HELP, /* use class menu */
- (HANDLE)hInstance, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
- GetStuffFromIni(lpDevice7,7,&Points,hLibrary);
-
- lpDevice7->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"LargeButton",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left , /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWnd, /*parent */
- (HMENU)IDC_VIDWIN, /* use class menu */
- (HANDLE)hInstance, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
-
-
-
- ShowWindow(lpDevice7->hWnd,SW_SHOWNORMAL);
-
- lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
- (*lpfnPlayVFWFile) (hWnd,lpDevice7->hWnd,lpDevice7->wDeviceID);
-
- lpDevice7->bVideoPlaying=TRUE;
-
- FreeLibrary(hLibrary);
- }
-
- return TRUE;
-
- }
-
-
- BOOL FAR PASCAL DoNextPage(hLibrary,nWhichButton)
- HANDLE hLibrary;
- int nWhichButton;
- {
- RECT Points;
- char szIniName[9];
- MSG msg;
-
- HideAllWindows();
-
- wsprintf(szIniName,"Button%d",nWhichButton);
-
- InitDeviceVars(lpDevice1);
-
- GetPG2FromIni(lpDevice1,1,&Points,hLibrary,szIniName);
- // MoveWindow(lpDevice1->hWnd,Points.left,Points.top,Points.right,Points.bottom,TRUE);
- ShowWindow( lpDevice1->hWnd, SW_SHOWNORMAL );
- SetWindowPos(lpDevice1->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
-
- InitDeviceVars(lpDevice2);
-
- GetPG2FromIni(lpDevice2,2,&Points,hLibrary,szIniName);
- // MoveWindow(lpDevice2->hWnd,Points.left,Points.top,Points.right,Points.bottom,TRUE);
- SetWindowPos(lpDevice2->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
- ShowWindow( lpDevice2->hWnd, SW_SHOWNORMAL );
-
- InitDeviceVars(lpDevice3);
-
- GetPG2FromIni(lpDevice3,3,&Points,hLibrary,szIniName);
- // MoveWindow(lpDevice3->hWnd,Points.left,Points.top,Points.right,Points.bottom,TRUE);
- SetWindowPos(lpDevice3->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
- ShowWindow( lpDevice3->hWnd, SW_SHOWNORMAL );
-
- InitDeviceVars(lpDevice4);
-
- GetPG2FromIni(lpDevice4,4,&Points,hLibrary,szIniName);
- // MoveWindow(lpDevice4->hWnd,Points.left,Points.top,Points.right,Points.bottom,TRUE);
- SetWindowPos(lpDevice4->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
- ShowWindow( lpDevice4->hWnd, SW_SHOWNORMAL );
-
- CreateVideoWindow(nWhichButton);
-
- // InitDeviceVars(lpDevice5);
-
- // GetPG2FromIni(lpDevice5,5,&Points,hLibrary,szIniName);
- //MoveWindow(lpDevice5->hWnd,Points.left,Points.top,Points.right,Points.bottom,TRUE);
- // SetWindowPos(lpDevice5->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
- // ShowWindow( lpDevice5->hWnd, SW_SHOWNORMAL );
-
- // InitDeviceVars(lpDevice6);
-
- // GetPG2FromIni(lpDevice6,6,&Points,hLibrary,szIniName);
- //MoveWindow(lpDevice6->hWnd,Points.left,Points.top,Points.right,Points.bottom,TRUE);
- // SetWindowPos(lpDevice6->hWnd,(HWND) NULL,Points.left,Points.top,Points.right,Points.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
- // ShowWindow( lpDevice6->hWnd, SW_SHOWNORMAL );
-
- bIsPage2=TRUE;
- bIsPage1=FALSE;
- bButtonDown=TRUE;
-
- return TRUE;
- }
-
- BOOL FAR PASCAL GetRealClientRect(hWndChild,hWndParent,lpWinRect)
- HWND hWndChild;
- HWND hWndParent;
- LPRECT lpWinRect;
- {
-
- POINT ptUpperLeft;
- POINT ptLowerRight;
-
- GetWindowRect(hWndChild,lpWinRect);
-
-
- ptUpperLeft.x=lpWinRect->left;
- ptUpperLeft.y=lpWinRect->top;
- ptLowerRight.x=lpWinRect->right;
- ptLowerRight.y=lpWinRect->bottom;
-
- ScreenToClient(hWndParent,&ptLowerRight);
- ScreenToClient(hWndParent,&ptUpperLeft);
-
- lpWinRect->left=ptUpperLeft.x;
- lpWinRect->top=ptUpperLeft.y;
- lpWinRect->right=ptLowerRight.x;
- lpWinRect->bottom=ptLowerRight.y;
-
- return TRUE;
-
- }
-
- BOOL FAR PASCAL DrawRectOutsideButton(hWnd,WinRect)
- HWND hWnd;
- RECT WinRect;
-
- {
- HDC hWinDC;
- HPEN hWinPen;
- HPEN hPenOld;
-
- hWinDC=GetDC(hWnd);
-
- hWinPen=CreatePen(PS_SOLID,4,RGB(0,0,0));
- hPenOld=SelectObject(hWinDC,hWinPen);
-
- Rectangle(hWinDC,WinRect.left-2,WinRect.top-2,WinRect.right+2,WinRect.bottom+2);
-
- SelectObject(hWinDC,hPenOld);
- DeleteObject(hWinPen);
-
- ReleaseDC(hWnd,hWinDC);
-
- return TRUE;
- }
-
- BOOL FAR PASCAL GetStuffFromIni(lpDevice,nButton,lpPoints,hLibrary)
- LPDEVICESTRUCT lpDevice;
- int nButton;
- LPRECT lpPoints;
- HANDLE hLibrary;
- {
- HANDLE hBuffer;
- LPSTR lpBuffer;
-
- HANDLE hSection;
- LPSTR lpSection;
-
- HANDLE hFileName;
- LPSTR lpFileName;
-
- HANDLE hEntry;
- LPSTR lpEntry;
-
- HANDLE hAlias;
- LPSTR lpAlias;
-
- HANDLE hExeName;
- LPSTR lpExeName;
-
- int nSize;
- int nBytes;
- int nAviFile;
- int nAudioFile;
- FARPROC lpfnOpenVFWFile;
- FARPROC lpfnOpenWaveFile;
-
- nAviFile=1;
- nAudioFile=1;
-
- hBuffer=GlobalAlloc(GHND,80);
- hSection=GlobalAlloc(GHND,10);
- hFileName=GlobalAlloc(GHND,128);
- hEntry=GlobalAlloc(GHND,20);
- hAlias=GlobalAlloc(GHND,10);
- hExeName=GlobalAlloc(GHND,10);
-
- if (hBuffer && hSection && hFileName && hEntry)
- {
- lpBuffer=GlobalLock(hBuffer);
- lpSection=GlobalLock(hSection);
- lpFileName=GlobalLock(hFileName);
- lpEntry=GlobalLock(hEntry);
- lpAlias=GlobalLock(hAlias);
- lpExeName=GlobalLock(hExeName);
-
- if (lpBuffer && lpSection && lpFileName && lpEntry && lpAlias)
- {
- nBytes=GetModuleFileName(GetModuleHandle("playvfw.exe"),lpFileName,128);
- if(nBytes)
- {
- wsprintf(lpSection,"Button%d",nButton);
- ExtractExtension(lpFileName,lpExeName);
- lstrcat(lpFileName,lpExeName);
- lstrcat(lpFileName,".ini");
-
- wsprintf(lpEntry,"AVI File%d",nAviFile);
- nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
- if(!nSize)
- {
- ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- StripSpaces(lpBuffer);
-
- wsprintf(lpAlias,"foo%d",nButton);
-
- lpfnOpenVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(9));
-
-
- lpDevice->wDeviceID = (*lpfnOpenVFWFile) (hWndMain,wGlobalDeviceID,(LPSTR)lpBuffer,lpAlias);
-
- if (!lpDevice->wDeviceID)
- {
- ReturnDeviceError(lpBuffer,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- wsprintf(lpEntry,"Audio File%d",nAudioFile);
- nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
-
- if(!nSize)
- {
- ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- StripSpaces(lpBuffer);
- //lstrcpy(lpDevice->szAudioFile,lpBuffer);
-
- wsprintf(lpAlias,"oof%d",nButton);
-
- lpfnOpenWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(16));
-
-
- lpDevice->wAudioDeviceID = (*lpfnOpenWaveFile) (wGlobalAudioDeviceID,lpBuffer,lpAlias);
-
- if (!lpDevice->wDeviceID)
- {
- ReturnDeviceError(lpBuffer,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- wsprintf(lpEntry,"Position%d",nAviFile);
- nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
- if(!nSize)
- {
- ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- StripSpaces(lpBuffer);
- ReturnCoor(lpBuffer,lpPoints);
-
- lstrcpy(lpEntry,"Animation");
- nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
-
- if(!nSize)
- {
- ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- StripSpaces(lpBuffer);
-
- if(!lstrcmp(lpBuffer,"disabled"))
- lpDevice->bPlayVideo=FALSE;
- else
- lpDevice->bPlayVideo=TRUE;
-
- lstrcpy(lpEntry,"Audio");
- nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
- if(!nSize)
- {
- ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- StripSpaces(lpBuffer);
-
- if(!lstrcmp(lpBuffer,"disabled"))
- lpDevice->bPlayAudio=FALSE;
- else
- lpDevice->bPlayAudio=TRUE;
- } // End if nBytes
- } // End of if the memory locks succeded.
- else
- {
- MessageBox(hWndMain,"Profile string Memory lock failed","ERROR",MB_OK);
- }
- } // End of if the memory allocations succeded.
- else
- MessageBox(hWndMain,"Memory allocation failed for profile strings","ERROR",MB_OK);
-
-
- GlobalUnlock(hFileName);
- GlobalUnlock(hSection);
- GlobalUnlock(hBuffer);
- GlobalUnlock(hEntry);
- GlobalUnlock(hAlias);
- GlobalUnlock(hExeName);
-
- GlobalFree(hFileName);
- GlobalFree(hSection);
- GlobalFree(hBuffer);
- GlobalFree(hEntry);
- GlobalFree(hAlias);
- GlobalFree(hExeName);
-
- return TRUE;
- }
-
- BOOL FAR PASCAL GetPG2FromIni(lpDevice,nButton,lpPoints,hLibrary,lpIniName)
- LPDEVICESTRUCT lpDevice;
- int nButton;
- LPRECT lpPoints;
- HANDLE hLibrary;
- LPSTR lpIniName;
- {
- HANDLE hBuffer;
- LPSTR lpBuffer;
-
- HANDLE hSection;
- LPSTR lpSection;
-
- HANDLE hFileName;
- LPSTR lpFileName;
-
- HANDLE hEntry;
- LPSTR lpEntry;
-
- HANDLE hAlias;
- LPSTR lpAlias;
-
- HANDLE hExeName;
- LPSTR lpExeName;
-
- int nSize;
- int nBytes;
- int nAviFile;
- int nAudioFile;
- FARPROC lpfnOpenVFWFile;
- FARPROC lpfnOpenWaveFile;
- FARPROC lpfnCloseVFWFile;
- FARPROC lpfnCloseWaveFile;
-
- BOOL bReturn;
-
- nAviFile=1;
- nAudioFile=1;
-
- hBuffer=GlobalAlloc(GHND,80);
- hSection=GlobalAlloc(GHND,10);
- hFileName=GlobalAlloc(GHND,128);
- hEntry=GlobalAlloc(GHND,20);
- hAlias=GlobalAlloc(GHND,20);
- hExeName=GlobalAlloc(GHND,10);
-
- if (hBuffer && hSection && hFileName && hEntry)
- {
- lpBuffer=GlobalLock(hBuffer);
- lpSection=GlobalLock(hSection);
- lpFileName=GlobalLock(hFileName);
- lpEntry=GlobalLock(hEntry);
- lpAlias=GlobalLock(hAlias);
- lpExeName=GlobalLock(hExeName);
-
- if (lpBuffer && lpSection && lpFileName && lpEntry && lpAlias)
- {
- nBytes=GetModuleFileName(GetModuleHandle("playvfw.exe"),lpFileName,128);
- if(nBytes)
- {
- wsprintf(lpSection,"Button%d",nButton);
- ExtractExtension(lpFileName,lpExeName);
- lstrcat(lpFileName,lpIniName);
- // put in check for a exe file already 8 characters long.
- //lstrcat(lpFileName,"2");
- lstrcat(lpFileName,".ini");
-
- wsprintf(lpEntry,"AVI File%d",nAviFile);
- nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
- if(!nSize)
- {
- ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- StripSpaces(lpBuffer);
-
- if(!lstrcmp(lpIniName,"morph"))
- wsprintf(lpAlias,"for%d",nButton);
- else
- wsprintf(lpAlias,"%s%d",lpIniName,nButton);
-
- lpfnOpenVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(9));
- lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
-
- if(lpDevice->wDeviceID)
- {
- lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
-
- bReturn = (*lpfnCloseVFWFile) (lpDevice->wDeviceID);
- }
-
- lpDevice->wDeviceID = (*lpfnOpenVFWFile) (hWndMain,wGlobalDeviceID,(LPSTR)lpBuffer,lpAlias);
-
- if (!lpDevice->wDeviceID)
- {
- ReturnDeviceError(lpBuffer,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- wsprintf(lpEntry,"Audio File%d",nAudioFile);
- nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
-
- if(!nSize)
- {
- ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- StripSpaces(lpBuffer);
- //lstrcpy(lpDevice->szAudioFile,lpBuffer);
- //wsprintf(lpAlias,"oof%d",nButton);
- if(!lstrcmp(lpIniName,"morph"))
- wsprintf(lpAlias,"%s%d",lpIniName,nButton);
- else
- wsprintf(lpAlias,"oof%d",nButton);
-
- lpfnOpenWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(16));
-
- if(lpDevice->wAudioDeviceID)
- {
- lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
- bReturn = (*lpfnCloseWaveFile) (lpDevice->wAudioDeviceID);
- }
-
- lpDevice->wAudioDeviceID = (*lpfnOpenWaveFile) (wGlobalAudioDeviceID,lpBuffer,lpAlias);
-
- if (!lpDevice->wAudioDeviceID)
- {
- ReturnDeviceError(lpBuffer,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- wsprintf(lpEntry,"Position%d",nAviFile);
- nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
- if(!nSize)
- {
- ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- StripSpaces(lpBuffer);
- ReturnCoor(lpBuffer,lpPoints);
-
- lstrcpy(lpEntry,"Animation");
- nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
-
- if(!nSize)
- {
- ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- StripSpaces(lpBuffer);
-
- if(!lstrcmp(lpBuffer,"disabled"))
- lpDevice->bPlayVideo=FALSE;
- else
- lpDevice->bPlayVideo=TRUE;
-
- lstrcpy(lpEntry,"Audio");
- nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
- if(!nSize)
- {
- ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- StripSpaces(lpBuffer);
-
- if(!lstrcmp(lpBuffer,"disabled"))
- lpDevice->bPlayAudio=FALSE;
- else
- lpDevice->bPlayAudio=TRUE;
-
- lstrcpy(lpEntry,"FileName");
-
- nSize=GetPrivateProfileString(lpSection,lpEntry,"",(LPSTR)lpDevice->szFileName,24,lpFileName);
- if(!nSize)
- {
- lstrcpy(lpBuffer,lpDevice->szFileName);
- ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- StripSpaces((LPSTR)lpDevice->szFileName);
-
- //lstrcpy(lpDevice->FileName,lpBuffer);
-
- } // End if nBytes
- } // End of if the memory locks succeded.
- else
- {
- MessageBox(hWndMain,"Profile string Memory lock failed","ERROR",MB_OK);
- }
- } // End of if the memory allocations succeded.
- else
- MessageBox(hWndMain,"Memory allocation failed for profile strings","ERROR",MB_OK);
-
-
- GlobalUnlock(hFileName);
- GlobalUnlock(hSection);
- GlobalUnlock(hBuffer);
- GlobalUnlock(hEntry);
- GlobalUnlock(hAlias);
- GlobalUnlock(hExeName);
-
- GlobalFree(hFileName);
- GlobalFree(hSection);
- GlobalFree(hBuffer);
- GlobalFree(hEntry);
- GlobalFree(hAlias);
- GlobalFree(hExeName);
-
- return TRUE;
- }
-
-
- // lpFileName will be of the form "c:\stuff\"
-
- BOOL FAR PASCAL ExtractExtension(lpFileName,lpExeName)
- LPSTR lpFileName;
- LPSTR lpExeName;
- {
- LPSTR lpF;
- LPSTR lpFTemp;
- LPSTR lpETemp;
- HANDLE hTempExe;
- LPSTR lpTempExe;
- LPSTR lpE2Temp;
-
- lpF=lpFileName;
-
- // set the pointer to the end of the string.
-
- while (*lpF!='\0')
- {
- lpFTemp++;
- lpF++;
- }
-
- // if the string is empty return an error;
-
- if (lpF!=lpFileName)
- lpF--;
-
- // scan back for a period in the file name, throwing out the extension.
-
- while ((*lpF!='.') && (lpF!=lpFileName) && (*lpF!='\\'))
- lpF--;
-
- // incorrect the file didn't have a path or an extension.
-
- if (lpF==lpFileName)
- {
- MessageBox(hWndMain,"Invalid File Extension","ERROR",MB_OK);
- return FALSE;
- }
-
- // if we didn't find a period there mustn't have been an extension. Reset
- // to end of string. Otherwise skip the period.
-
- if(*lpF=='\\')
- lpF=lpFTemp;
- else
- lpF--;
-
- // scan string until a \ is found.
-
- hTempExe=GlobalAlloc(GHND,128);
- if (hTempExe)
- {
- lpTempExe=GlobalLock(hTempExe);
- if (lpTempExe)
- {
- // set up a third party variable.
-
- lpETemp=lpTempExe;
-
- // read the string backwards into the temporary variable.
-
- while ((*lpF!='\\') && (lpF!=lpFileName))
- *lpETemp++=*lpF--;
-
- *lpETemp='\0';
- lpETemp--;
-
- // reread the string backwards and place it into the Exe name
- // variable in its correct (forward order).
-
- lpE2Temp=lpExeName;
-
- while (lpETemp!=lpTempExe)
- *lpE2Temp++=*lpETemp--;
-
- // get the last character or the first character depending on how
- // you look at it.
-
- *lpE2Temp++=*lpETemp;
-
- *lpE2Temp='\0';
- }
-
- GlobalUnlock(hTempExe);
- GlobalFree(hTempExe);
- }
- // if we are at the begining of the string and a \ was not found error.
-
-
- if (lpF==lpFileName)
- {
- MessageBox(hWndMain,"Invalid File Extension","ERROR",MB_OK);
- return FALSE;
- }
-
- // increment one past the last backslash and add a null to terminate string.
-
- lpF++;
- *lpF='\0';
-
- return TRUE;
- }
-
-
- BOOL FAR PASCAL StripSpaces(lpBuffer)
- LPSTR lpBuffer;
- {
- LPSTR lpNew;
- LPSTR lpOld;
-
- lpNew=lpBuffer;
- lpOld=lpBuffer;
-
- while (*lpNew!='\0')
- if (*lpNew==' ')
- lpNew++;
- else
- *lpOld++=*lpNew++;
-
- *lpOld='\0';
-
- return TRUE;
- }
-
- BOOL FAR PASCAL ReturnCoor(lpBuff,lpPoints)
- LPSTR lpBuff;
- LPRECT lpPoints;
- {
- char szNum[10];
- int nCoor;
- LPSTR lpPB;
- LPSTR lpNum;
-
- lpPB=lpBuff;
- lpNum=szNum;
-
- while ((*lpPB!='\0') && (*lpPB!=','))
- *lpNum++=*lpPB++;
-
- if (*lpPB=='\0')
- {
- MessageBox(hWndMain,"incorrect position string","ERROR",MB_OK);
- return FALSE;
- }
-
- *lpNum='\0';
-
- nCoor=atoi(szNum);
- lpPoints->left=nCoor;
-
- lpNum=szNum;
- lpPB++;
-
- while ((*lpPB!='\0') && (*lpPB!=','))
- *lpNum++=*lpPB++;
-
- if (*lpPB=='\0')
- {
- MessageBox(hWndMain,"incorrect position string","ERROR",MB_OK);
- return FALSE;
- }
-
- *lpNum='\0';
-
- nCoor=atoi(szNum);
- lpPoints->top=nCoor;
-
- lpNum=szNum;
- lpPB++;
-
- while ((*lpPB!='\0') && (*lpPB!=','))
- *lpNum++=*lpPB++;
-
- if (*lpPB=='\0')
- {
- MessageBox(hWndMain,"incorrect position string","ERROR",MB_OK);
- return FALSE;
- }
-
- *lpNum='\0';
-
- nCoor=atoi(szNum);
- lpPoints->right=nCoor;
-
- lpNum=szNum;
- lpPB++;
-
- while ((*lpPB!='\0') && (*lpPB!=','))
- *lpNum++=*lpPB++;
-
- if (*lpPB==',')
- {
- MessageBox(hWndMain,"incorrect position string","ERROR",MB_OK);
- return FALSE;
- }
-
- *lpNum='\0';
-
- nCoor=atoi(szNum);
- lpPoints->bottom=nCoor;
-
- return TRUE;
- }
-
- void FAR PASCAL ReturnProfileError(LPSTR lpEntry,LPSTR lpSection,LPSTR lpFileName,HANDLE hFileName,HANDLE hSection,HANDLE hBuffer,HANDLE hExeName,HANDLE hAlias)
- {
-
- HANDLE hBuf;
- LPSTR lpBuf;
-
- hBuf=GlobalAlloc(GHND,255);
- if(!hBuf)
- return;
-
- lpBuf=GlobalLock(hBuf);
-
- if (!lpBuf)
- return;
-
- wsprintf(lpBuf,"The %s entry for %s was omitted in the %s file. Please edit the ini file.",lpEntry,lpSection,lpFileName);
- MessageBox(hWndMain,lpBuf,"ERROR",MB_OK);
-
- GlobalUnlock(hFileName);
- GlobalUnlock(hSection);
- GlobalUnlock(hBuffer);
- GlobalUnlock(hExeName);
- GlobalUnlock(hAlias);
- GlobalUnlock(hBuf);
-
- GlobalFree(hFileName);
- GlobalFree(hSection);
- GlobalFree(hBuffer);
- GlobalFree(hExeName);
- GlobalFree(hAlias);
- GlobalFree(hBuf);
-
- return;
- }
-
-
-
- void FAR PASCAL ReturnDeviceError(LPSTR lpBuffer,HANDLE hFileName,HANDLE hSection,HANDLE hBuffer,HANDLE hExeName,HANDLE hAlias)
- {
- HANDLE hBuf;
- LPSTR lpBuf;
-
- hBuf=GlobalAlloc(GHND,255);
- if(!hBuf)
- return;
-
- lpBuf=GlobalLock(hBuf);
-
- if (!lpBuf)
- return;
-
- wsprintf(lpBuf,"The %s file could not be open. Check that the file exists and that it is correct in the initialization file",lpBuffer);
- MessageBox(hWndMain,lpBuf,"ERROR",MB_OK);
-
- GlobalUnlock(hFileName);
- GlobalUnlock(hSection);
- GlobalUnlock(hBuffer);
- GlobalUnlock(hExeName);
- GlobalUnlock(hAlias);
- GlobalUnlock(hBuf);
-
- GlobalFree(hFileName);
- GlobalFree(hSection);
- GlobalFree(hBuffer);
- GlobalFree(hExeName);
- GlobalFree(hAlias);
- GlobalFree(hBuf);
-
- return;
- }
-
-
- BOOL FAR PASCAL InitDeviceVars(lpDevice)
- LPDEVICESTRUCT lpDevice;
- {
- lpDevice->bVideoPlaying=FALSE;
- lpDevice->bAudioPlaying=FALSE;
- lpDevice->bVideoPaused=FALSE;
- lpDevice->bButtonDown=FALSE;
- lpDevice->bRButtonClicked=FALSE;
-
- return TRUE;
- }
-
-
- BOOL FAR PASCAL Morph(lpDevice,nWhichButton,hLibrary)
- LPDEVICESTRUCT lpDevice;
- int nWhichButton;
- HANDLE hLibrary;
- {
- RECT Points;
-
-
- GetPG2FromIni(lpDevice,nWhichButton,&Points,hLibrary,"morph");
-
-
- lpDevice->hWnd = CreateWindow((LPSTR)"button",
- (LPSTR)"MorphButton",
- WS_CHILD | BS_OWNERDRAW | WS_CLIPSIBLINGS,
- Points.left , /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWndMain, /*parent */
- (HMENU)IDC_MORPH, /* use class menu */
- (HANDLE)hInst, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
-
-
- ShowWindow(lpDevice->hWnd, SW_SHOWNORMAL );
- SetWindowPos(lpDevice->hWnd,HWND_TOP,Points.left,Points.top,Points.bottom,Points.right,SWP_SHOWWINDOW);
- //DrawRectOutsideButton(hWndMain,ChildWinRect);
-
-
-
- return TRUE;
-
- }
-
- BOOL FAR PASCAL AllDone()
- {
- if (lpDevice1->bRButtonClicked || lpDevice2->bRButtonClicked || lpDevice3->bRButtonClicked ||
- lpDevice4->bRButtonClicked || lpDevice5->bRButtonClicked || lpDevice6->bRButtonClicked)
- {
- if (!lpDevice1->bVideoPlaying && !lpDevice2->bVideoPlaying && !lpDevice3->bVideoPlaying
- && !lpDevice4->bVideoPlaying && !lpDevice5->bVideoPlaying && !lpDevice6->bVideoPlaying)
- {
- return TRUE;
- }
- else
- return FALSE;
- }
- else
- return FALSE;
-
- }
-
- BOOL FAR PASCAL SeekAllToStart()
- {
- HANDLE hLibrary;
- FARPROC lpfnSeekVFWToStart;
-
-
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
-
- if (hLibrary >= 32)
- {
-
- lpfnSeekVFWToStart = GetProcAddress(hLibrary, MAKEINTRESOURCE(8));
-
- (*lpfnSeekVFWToStart) (lpDevice1->wDeviceID);
- lpDevice1->bVideoPlaying=FALSE;
- (*lpfnSeekVFWToStart) (lpDevice2->wDeviceID);
- lpDevice2->bVideoPlaying=FALSE;
- (*lpfnSeekVFWToStart) (lpDevice3->wDeviceID);
- lpDevice3->bVideoPlaying=FALSE;
- (*lpfnSeekVFWToStart) (lpDevice4->wDeviceID);
- lpDevice4->bVideoPlaying=FALSE;
- (*lpfnSeekVFWToStart) (lpDevice5->wDeviceID);
- lpDevice5->bVideoPlaying=FALSE;
- (*lpfnSeekVFWToStart) (lpDevice6->wDeviceID);
- lpDevice6->bVideoPlaying=FALSE;
- FreeLibrary(hLibrary);
- }
-
- return TRUE;
- }
-
-
- BOOL FAR PASCAL HideAllWindows()
- {
- ShowWindow( lpDevice1->hWnd, SW_HIDE );
- ShowWindow( lpDevice2->hWnd, SW_HIDE );
- ShowWindow( lpDevice3->hWnd, SW_HIDE );
- ShowWindow( lpDevice4->hWnd, SW_HIDE );
- ShowWindow( lpDevice5->hWnd, SW_HIDE );
- ShowWindow( lpDevice6->hWnd, SW_HIDE );
- ShowWindow( lpDevice7->hWnd, SW_HIDE );
- ShowWindow( lpDevice8->hWnd, SW_HIDE );
- return TRUE;
- }
-
-
-
-
-
- BOOL FAR PASCAL FreeDevices(hWnd)
- HANDLE hWnd;
- {
- HANDLE hLibrary;
- BOOL bReturn;
- FARPROC lpfnCloseWaveFile;
- FARPROC lpfnCloseWaveDevice;
- FARPROC lpfnCloseVFWFile;
- FARPROC lpfnCloseVFWDevice;
- FARPROC lpfnCloseAllDevices;
- MSG msg;
-
- //SeekAllToStart();
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
-
- if (hLibrary >= 32)
- {
- //lpfnCloseAllDevices = GetProcAddress(hLibrary, MAKEINTRESOURCE(20));
- //bReturn = (*lpfnCloseAllDevices) ();
-
- lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
-
- //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
- if (lpDevice1->wAudioDeviceID)
- {
- bReturn = (*lpfnCloseWaveFile) (lpDevice1->wAudioDeviceID);
- lpDevice1->wAudioDeviceID=0;
- }
-
- // while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
- if (lpDevice2->wAudioDeviceID)
- {
-
- bReturn = (*lpfnCloseWaveFile) (lpDevice2->wAudioDeviceID);
- lpDevice2->wAudioDeviceID=0;
- }
-
- //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
- if (lpDevice3->wAudioDeviceID)
- {
- bReturn = (*lpfnCloseWaveFile) (lpDevice3->wAudioDeviceID);
- lpDevice3->wAudioDeviceID=0;
- }
- //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
- if (lpDevice4->wAudioDeviceID)
- {
- bReturn = (*lpfnCloseWaveFile) (lpDevice4->wAudioDeviceID);
- lpDevice4->wAudioDeviceID=0;
- }
-
- //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
-
- if (lpDevice5->wAudioDeviceID)
- {
- bReturn = (*lpfnCloseWaveFile) (lpDevice5->wAudioDeviceID);
- lpDevice5->wAudioDeviceID=0;
- }
-
- //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
-
- if (lpDevice6->wAudioDeviceID)
- {
- bReturn = (*lpfnCloseWaveFile) (lpDevice6->wAudioDeviceID);
- lpDevice6->wAudioDeviceID=0;
- }
-
- lpfnCloseWaveDevice = GetProcAddress(hLibrary, MAKEINTRESOURCE(19));
-
- if (wGlobalAudioDeviceID)
- {
- bReturn = (*lpfnCloseWaveDevice) (wGlobalAudioDeviceID);
- wGlobalAudioDeviceID=0;
- }
-
-
- lpfnCloseVFWDevice = GetProcAddress(hLibrary, MAKEINTRESOURCE(4));
-
-
- lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
-
- //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
- if (lpDevice1->wDeviceID)
- {
- bReturn = (*lpfnCloseVFWFile) (lpDevice1->wDeviceID);
- lpDevice1->wDeviceID=0;
- }
-
- //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
- if (lpDevice2->wDeviceID)
- {
- bReturn = (*lpfnCloseVFWFile) (lpDevice2->wDeviceID);
- lpDevice2->wDeviceID=0;
- }
- //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
-
- if (lpDevice3->wDeviceID)
- {
- bReturn = (*lpfnCloseVFWFile) (lpDevice3->wDeviceID);
- lpDevice3->wDeviceID=0;
- }
-
- //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
- if (lpDevice4->wDeviceID)
- {
- bReturn = (*lpfnCloseVFWFile) (lpDevice4->wDeviceID);
- lpDevice4->wDeviceID=0;
- }
-
- //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
-
- if (lpDevice5->wDeviceID)
- {
- bReturn = (*lpfnCloseVFWFile) (lpDevice5->wDeviceID);
- lpDevice5->wDeviceID=0;
- }
-
- //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
- if (lpDevice6->wDeviceID)
- {
- bReturn = (*lpfnCloseVFWFile) (lpDevice6->wDeviceID);
- lpDevice6->wDeviceID=0;
- }
-
- if (lpDevice9->wDeviceID)
- {
- bReturn = (*lpfnCloseVFWFile) (lpDevice9->wDeviceID);
- lpDevice9->wDeviceID=0;
- }
-
- //while (PeekMessage(&msg,NULL,0,0,PM_REMOVE));
- if (wGlobalDeviceID)
- {
- bReturn = (*lpfnCloseVFWDevice) (hWnd,wGlobalDeviceID);
- wGlobalDeviceID=0;
- }
-
- FreeLibrary(hLibrary);
-
- /* grey menu item first */
- /* enable second */
- }
- return TRUE;
-
- }
-
- BOOL FAR PASCAL CreateVideoWindow(nButton)
- int nButton;
- {
- HANDLE hVidWnd;
- char szIniName[11];
- RECT Points;
- RECT Points2;
- HANDLE hLibrary;
- FARPROC lpfnUpdateVFW;
- HDC hTempDC;
- DLGPROC dlgProc;
-
- wsprintf(szIniName,"button%d",nButton);
- //lstrcpy(szIniName,"playvfw");
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
-
- if (hLibrary >= 32)
- {
- GetVidWinFromIni(lpDevice9,9,&Points,&Points2,hLibrary,szIniName);
-
- lpDevice9->hWnd = CreateWindow((LPSTR)"VidWin",
- (LPSTR)"Video Window",
- WS_CHILD | WS_CLIPSIBLINGS,
- Points.left , /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWndMain, /*parent */
- (HMENU)NULL, /* use class menu */
- (HANDLE)hInst, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
-
- hWndEdit = CreateWindow((LPSTR)"Edit",
- (LPSTR)"Edit Window",
- WS_CHILD | WS_CLIPSIBLINGS | ES_MULTILINE | ES_AUTOVSCROLL,
- Points.left , /* x - ignored for tiled windows */
- Points.top, /* y - ignored for tiled windows */
- Points.right, /* cx - ignored for tiled windows */
- Points.bottom, /* cy - ignored for tiled windows */
- (HWND)hWndMain, /*parent */
- (HMENU)IDC_EDIT, /* use class menu */
- (HANDLE)hInst, /* handle to window instance */
- (LPSTR)NULL /* no params to pass on */
- );
- ReadTextFileIntoEdit();
-
- lpfnUpdateVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(11));
-
- hTempDC=GetDC(lpDevice9->hWnd);
-
- (*lpfnUpdateVFW) (lpDevice9->wDeviceID,hTempDC);
-
- ReleaseDC(lpDevice9->hWnd,hTempDC);
-
- ShowWindow(lpDevice9->hWnd, SW_SHOWNORMAL );
-
- dlgProc=(DLGPROC)MakeProcInstance(ButtonBarProc,hInst);
-
- hWndButtonBar=CreateDialog(hInst,MAKEINTRESOURCE(BUTTONBAR),hWndMain,dlgProc);
-
- SetWindowPos(hWndButtonBar,(HWND) NULL,Points2.left,Points2.top,Points2.right,Points2.bottom,SWP_NOACTIVATE | SWP_NOZORDER);
-
- ShowWindow(hWndButtonBar,SW_SHOW);
-
- FreeLibrary(hLibrary);
- }
- return FALSE;
- }
-
- BOOL FAR PASCAL GetVidWinFromIni(lpDevice,nButton,lpPoints,lpPoints2,hLibrary,lpIniName)
- LPDEVICESTRUCT lpDevice;
- int nButton;
- LPRECT lpPoints;
- LPRECT lpPoints2;
- HANDLE hLibrary;
- LPSTR lpIniName;
- {
- HANDLE hBuffer;
- LPSTR lpBuffer;
-
- HANDLE hSection;
- LPSTR lpSection;
-
- HANDLE hFileName;
- LPSTR lpFileName;
-
- HANDLE hEntry;
- LPSTR lpEntry;
-
- HANDLE hAlias;
- LPSTR lpAlias;
-
- HANDLE hExeName;
- LPSTR lpExeName;
-
- int nSize;
- int nBytes;
- int nAviFile;
- int nAudioFile;
- FARPROC lpfnOpenVFWFile;
- FARPROC lpfnOpenWaveFile;
- FARPROC lpfnCloseVFWFile;
- FARPROC lpfnCloseWaveFile;
-
- BOOL bReturn;
-
- nAviFile=1;
- nAudioFile=1;
-
- hBuffer=GlobalAlloc(GHND,80);
- hSection=GlobalAlloc(GHND,10);
- hFileName=GlobalAlloc(GHND,128);
- hEntry=GlobalAlloc(GHND,20);
- hAlias=GlobalAlloc(GHND,20);
- hExeName=GlobalAlloc(GHND,10);
-
- if (hBuffer && hSection && hFileName && hEntry)
- {
- lpBuffer=GlobalLock(hBuffer);
- lpSection=GlobalLock(hSection);
- lpFileName=GlobalLock(hFileName);
- lpEntry=GlobalLock(hEntry);
- lpAlias=GlobalLock(hAlias);
- lpExeName=GlobalLock(hExeName);
-
- if (lpBuffer && lpSection && lpFileName && lpEntry && lpAlias)
- {
- nBytes=GetModuleFileName(GetModuleHandle("playvfw.exe"),lpFileName,128);
- if(nBytes)
- {
- wsprintf(lpSection,"Button%d",nButton);
- ExtractExtension(lpFileName,lpExeName);
-
- lstrcat(lpFileName,lpIniName);
- // put in check for a exe file already 8 characters long.
- //lstrcat(lpFileName,"2");
- lstrcat(lpFileName,".ini");
-
- wsprintf(lpEntry,"AVI File%d",nAviFile);
- nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
- if(!nSize)
- {
- ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- StripSpaces(lpBuffer);
-
-
- wsprintf(lpAlias,"%s%d","VidWin");
-
- lpfnOpenVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(9));
-
- lpDevice->wDeviceID = (*lpfnOpenVFWFile) (hWndMain,wGlobalDeviceID,(LPSTR)lpBuffer,lpAlias);
-
- if (!lpDevice->wDeviceID)
- {
- ReturnDeviceError(lpBuffer,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
-
-
- wsprintf(lpEntry,"Position%d",nAviFile);
- nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
- if(!nSize)
- {
- ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- StripSpaces(lpBuffer);
- ReturnCoor(lpBuffer,lpPoints);
-
- lstrcpy(lpEntry,"ControlPos");
- nSize=GetPrivateProfileString(lpSection,lpEntry,"",lpBuffer,80,lpFileName);
- if(!nSize)
- {
- ReturnProfileError(lpEntry,lpSection,lpFileName,hFileName,hSection,hBuffer,hExeName,hAlias);
- return FALSE;
- }
-
- StripSpaces(lpBuffer);
- ReturnCoor(lpBuffer,lpPoints2);
-
-
- } // End if nBytes
- } // End of if the memory locks succeded.
- else
- {
- MessageBox(hWndMain,"Profile string Memory lock failed","ERROR",MB_OK);
- }
- } // End of if the memory allocations succeded.
- else
- MessageBox(hWndMain,"Memory allocation failed for profile strings","ERROR",MB_OK);
-
-
- GlobalUnlock(hFileName);
- GlobalUnlock(hSection);
- GlobalUnlock(hBuffer);
- GlobalUnlock(hEntry);
- GlobalUnlock(hAlias);
- GlobalUnlock(hExeName);
-
- GlobalFree(hFileName);
- GlobalFree(hSection);
- GlobalFree(hBuffer);
- GlobalFree(hEntry);
- GlobalFree(hAlias);
- GlobalFree(hExeName);
-
- return TRUE;
- }
-
-
- /* Procedures which make up the window class. */
- long FAR PASCAL VideoWndProc( hWnd, message, wParam, lParam )
- HWND hWnd;
- unsigned message;
- WORD wParam;
- LONG lParam;
- {
- switch (message)
- {
- case WM_CREATE:
-
- break;
-
- case WM_SYSCOMMAND:
- switch (wParam)
- {
-
-
- default:
- return DefWindowProc( hWnd, message, wParam, lParam );
-
- }
- break;
-
- case WM_COMMAND:
- break;
-
- case WM_DESTROY:
-
- PostQuitMessage( 0 );
- break;
-
- // case WM_PAINT:
-
-
- // BeginPaint( hWnd, (LPPAINTSTRUCT)&ps );
- // PlayVFWPaint( ps.hdc );
- // EndPaint( hWnd, (LPPAINTSTRUCT)&ps );
- // break;
-
- default:
- return DefWindowProc( hWnd, message, wParam, lParam );
- break;
- }
- return(0L);
-
- }
-
- BOOL FAR PASCAL _export ButtonBarProc( hDlg, message, wParam, lParam )
- HWND hDlg;
- unsigned message;
- WORD wParam;
- LONG lParam;
- {
-
- HANDLE hLibrary;
- FARPROC lpfnPlayVFWFile;
- FARPROC lpfnStopVFWFile;
- FARPROC lpfnPauseVFWFile;
- FARPROC lpfnStepVFWReverse;
- FARPROC lpfnStepVFW;
- FARPROC lpfnResumeVFWFile;
- FARPROC lpfnSeekVFWToStart;
- static BOOL bIsPaused;
-
-
- switch (message)
- {
- case WM_INITDIALOG:
- bIsPaused=FALSE;
- break;
-
- case WM_COMMAND:
- {
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
-
- if (hLibrary >= 32)
- {
- switch (wParam)
- {
- case ID_PLAY:
- ShowWindow( hWndEdit, SW_HIDE );
- ShowWindow(lpDevice9->hWnd, SW_SHOWNORMAL );
-
- if (bIsPaused)
- {
- lpfnResumeVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(13));
- (*lpfnResumeVFWFile) (hWndMain,lpDevice9->hWnd,lpDevice9->wDeviceID);
- bIsPaused=FALSE;
- }
- else
- {
- lpfnPlayVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(3));
- (*lpfnPlayVFWFile) (hWndMain,lpDevice9->hWnd,lpDevice9->wDeviceID);
- }
- break;
-
- case ID_STOP:
- lpfnStopVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(23));
- (*lpfnStopVFWFile) (lpDevice9->wDeviceID);
-
- break;
-
- case ID_PAUSE:
- if (bIsPaused)
- {
- lpfnResumeVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(13));
- (*lpfnResumeVFWFile) (hWndMain,lpDevice9->hWnd,lpDevice9->wDeviceID);
- bIsPaused=FALSE;
- }
- else
- {
- lpfnPauseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(12));
- (*lpfnPauseVFWFile) (lpDevice9->wDeviceID);
- bIsPaused=TRUE;
- }
- break;
-
- case ID_REWIND:
-
- lpfnSeekVFWToStart = GetProcAddress(hLibrary, MAKEINTRESOURCE(8));
- (*lpfnSeekVFWToStart) (lpDevice9->wDeviceID);
- break;
-
- case ID_FORWARD:
- lpfnStepVFW = GetProcAddress(hLibrary, MAKEINTRESOURCE(21));
- (*lpfnStepVFW) (lpDevice9->wDeviceID,5);
- break;
-
- case ID_BACK:
- lpfnStepVFWReverse = GetProcAddress(hLibrary, MAKEINTRESOURCE(22));
- (*lpfnStepVFWReverse) (lpDevice9->wDeviceID);
-
- break;
- }
- FreeLibrary(hLibrary);
- }
- }
- break;
-
- default:
- return FALSE;
- }
-
- return FALSE;
- }
-
- BOOL FAR PASCAL DoPage1()
-
- {
- FARPROC lpfnCloseWaveFile;
- FARPROC lpfnCloseVFWFile;
- HANDLE hLibrary;
- BOOL bReturn;
-
- hLibrary = LoadLibrary((LPSTR)"plyvfw.dll");
-
- if (hLibrary >= 32)
- {
- bIsPage0=FALSE;
- bIsPage1=TRUE;
-
- ShowWindow(lpDevice1->hWnd,SW_SHOWNORMAL);
- ShowWindow(lpDevice2->hWnd,SW_SHOWNORMAL);
- ShowWindow(lpDevice3->hWnd,SW_SHOWNORMAL);
- ShowWindow(lpDevice4->hWnd,SW_SHOWNORMAL);
- ShowWindow(lpDevice5->hWnd,SW_SHOWNORMAL);
- ShowWindow(lpDevice6->hWnd,SW_SHOWNORMAL);
- ShowWindow(lpDevice7->hWnd,SW_HIDE);
-
- lpfnCloseWaveFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(18));
-
- bReturn = (*lpfnCloseWaveFile) (lpDevice7->wAudioDeviceID);
- lpfnCloseVFWFile = GetProcAddress(hLibrary, MAKEINTRESOURCE(10));
-
-
- bReturn = (*lpfnCloseVFWFile) (lpDevice7->wDeviceID);
- FreeLibrary(hLibrary);
- }
-
- return TRUE;
- }
-
-
- BOOL FAR PASCAL ReadTextFileIntoEdit()
- {
- OFSTRUCT pof;
- HANDLE hFile;
- int nBytes;
- int bytes;
- LPSTR lpFileName;
- HANDLE hFileName;
- HANDLE hExeName;
- HANDLE hBuffer;
- LPSTR lpExeName;
- LPSTR lpBuffer;
- LPSTR lpTmpBuf;
- int i;
-
- hFileName=GlobalAlloc(GHND,128);
- hExeName=GlobalAlloc(GHND,10);
- hBuffer=GlobalAlloc(GHND,80+1);
- if (hFileName && hExeName && hBuffer)
- {
- lpFileName=GlobalLock(hFileName);
- lpExeName=GlobalLock(hExeName);
- lpBuffer=GlobalLock(hBuffer);
- if(lpFileName && hExeName && hBuffer)
- {
- nBytes=GetModuleFileName(GetModuleHandle("playvfw.exe"),lpFileName,128);
- if(nBytes)
- {
- ExtractExtension(lpFileName,lpExeName);
-
- if(!lstrlen(lpDevice1->szFileName))
- {
- MessageBox(hWndMain,"Text File Name is invalid","ERROR",MB_OK);
- return FALSE;
- }
-
- lstrcat(lpFileName,lpDevice1->szFileName);
- hFile=OpenFile(lpFileName,&pof,OF_READWRITE);
-
- if (hFile==-1)
- {
- MessageBox(hWndMain,"Unable to open File","Check that text file exists",MB_OK);
- return FALSE;
- }
-
- _llseek (hFile,0L,0);
-
- bytes=_lread(hFile,lpBuffer,80);
-
- while(bytes==80)
- {
- lpTmpBuf=lpBuffer;
-
- for(i=0;i<80;++i)
- ++lpTmpBuf;
-
- *lpTmpBuf='\0';
-
- //nLength=SendMessage(hWndEdit,EM_GETLINE,wLine,lpBuffer);
- SendMessage(hWndEdit,EM_REPLACESEL,0,(LONG)lpBuffer);
- bytes=_lread(hFile,lpBuffer,80);
-
- }
-
- if (bytes>0)
- {
- lpTmpBuf=lpBuffer;
-
- for(i=0;i<bytes;++i)
- ++lpTmpBuf;
-
- *lpTmpBuf='\0';
-
- SendMessage(hWndEdit,EM_REPLACESEL,0,(LONG)lpBuffer);
- }
- }// if nBytes
- else
- {
- MessageBox(hWndMain,"couldn't get pathname","ERROR",MB_OK);
- return FALSE;
- }
- }// if global lock
- else
- {
- MessageBox(hWndMain,"Global Lock Failed","ERROR",MB_OK);
- return FALSE;
- }
- }// if global alloc
- else
- {
- MessageBox(hWndMain,"Global Alloc failed","ERROR",MB_OK);
- return FALSE;
- }
- return TRUE;
- }
-